import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
//新建活动
const newActivity = r => require.ensure([], () => r(require('@/page/newActivity')), 'newActivity');
const chooseTemplate = r => require.ensure([], () => r(require('@/page/chooseTpl/chooseTemplate')), 'chooseTemplate');
const ownedAll = r => require.ensure([], () => r(require('@/page/chooseTpl/owned-all')), 'ownedAll');
const theirOwn = r => require.ensure([], () => r(require('@/page/chooseTpl/their-own')), 'theirOwn');

const surveyTpl = r => require.ensure([], () => r(require('@/page/surveyTpl')), 'surveyTpl');
//更多活动
const activityMore = r => require.ensure([], () => r(require('@/page/activityMore')), 'activityMore');

//通用模板
const commonTpl = r => require.ensure([], () => r(require('@/page/commonTpl')), 'commonTpl');
//编辑通用模板活动
const editCommonTpl = r => require.ensure([], () => r(require('@/page/editCommonTpl')), 'editCommonTpl');

//输口令模板
const setTemplate_code = r => require.ensure([], () => r(require('@/page/setTemplate_code')), 'setTemplate_code');
//编辑口令模板
const eidtTplCode = r => require.ensure([], () => r(require('@/page/eidtTplCode')), 'eidtTplCode');
//活动列表
const activityList = r => require.ensure([], () => r(require('@/page/activityList')), 'activityList');
//活动统计 
const actStatistics = r => require.ensure([], () => r(require('@/page/actStatistics')), 'actStatistics');
//活动报表
const statistics = r => require.ensure([], () => r(require('@/page/statistics')), 'statistics');
//新建奖品 
const newPrize = r => require.ensure([], () => r(require('@/page/newPrize')), 'newPrize');
//新建平台奖品 
const newPlatformPrize = r => require.ensure([], () => r(require('@/page/newPlatformPrize')), 'newPlatformPrize');
//编辑奖品 
const editPrize = r => require.ensure([], () => r(require('@/page/editPrize')), 'editPrize');
//购买奖品 
const buyPrize = r => require.ensure([], () => r(require('@/page/buyPrize')), 'buyPrize');
//充值
const recharge = r => require.ensure([], () => r(require('@/page/recharge')), 'recharge');
//奖品列表
const prizeList = r => require.ensure([], () => r(require('@/page/prizeList')), 'prizeList');
//兑奖中心
const prizeCenter = r => require.ensure([], () => r(require('@/page/prizeCenter')), 'prizeCenter');
//应用设置
const  setMessage= r => require.ensure([], () => r(require('@/page/setMessage/setMessage')), 'setMessage');
//微信设置
const wxSet = r => require.ensure([], () => r(require('@/page/setMessage/wxSet')), 'wxSet');
//推送设置
const configSet = r => require.ensure([], () => r(require('@/page/setMessage/configSet')), 'configSet');
//对接设置
const apiConfigSet = r => require.ensure([], () => r(require('@/page/setMessage/apiConfigSet')), 'apiConfigSet');
//应用设置
const application = r => require.ensure([], () => r(require('@/page/setMessage/application')), 'application');

//新建投放埋点
const putCreate = r => require.ensure([], () => r(require('@/page/putCreate')), 'putCreate');
//编辑投放
const editPutList = r => require.ensure([], () => r(require('@/page/editPutList')), 'editPutList');

//位置埋点
const position = r => require.ensure([], () => r(require('@/page/position')), 'position');
//投放列表
const putActivityList = r => require.ensure([], () => r(require('@/page/putActivityList')), 'putActivityList');

//触发行为管理
const eventAdmin = r => require.ensure([], () => r(require('@/page/eventAdmin')), 'eventAdmin');
//触发列表
const triggers = r => require.ensure([], () => r(require('@/page/triggers')), 'triggers');
//新建触发
const triggersCreate = r => require.ensure([], () => r(require('@/page/triggersCreate')), 'triggersCreate');
//触发编辑数据
const editTriggers = r => require.ensure([], () => r(require('@/page/editTriggers')), 'editTriggers');

//推送活动
const pushNew = r => require.ensure([], () => r(require('@/page/pushNew')), 'pushNew');

//推送列表
const pushList = r => require.ensure([], () => r(require('@/page/pushList')), 'pushList');


////报名单个报名（图片）
const voteScreen= r => require.ensure([], () => r(require('@/page/voteTpl/vote-screen')), 
'voteScreen');  

//活动编辑报名模板
const editVoteScreen= r => require.ensure([], () => r(require('@/page/voteTpl/edit-vote-screen')), 
'editVoteScreen');   

//投票记录
const voteRecordCenter = r => require.ensure([], () => r(require('@/page/voteRecordCenter')), 'voteRecordCenter');

//投票数据
const voteData = r => require.ensure([], () => r(require('@/page/voteData')), 'voteData');

const routes = [
	{
		path: '/web/activity/dashboard',
		name:'home',
		component: home,
		meta: ['活动管理-数据统计'],
	}, {
		path: '/web/activity/add',
		name:'newActivity',
		component: newActivity,
		meta: ['活动管理-新建活动'],
	}, {
		path: '/chooseTemplate',
		component: chooseTemplate,
		meta: ['新建活动-选择模板'],
		children:[
			{
				path: '/ownedAll',
				name:'ownedAll',
				component: ownedAll,
				meta: ['新建活动-共有模板'],
			},
			{
				path: '/theirOwn',
				name:'theirOwn',
				component: theirOwn,
				meta: ['新建活动-共有模板'],
			}
		]
	},{
		path: '/activityMore',
		name:'activityMore',
		component: activityMore,
		meta: ['新建活动-更多活动'],
	}, {
		path: '/commonTpl',
		name:'commonTpl',
		component: commonTpl,
		meta: ['新建活动-活动设置'],
	},  {
		path: '/surveyTpl',   
		name:'surveyTpl',
		component: surveyTpl,
		meta: ['新建活动-活动设置'],
	},  {
		path: '/voteScreen',   
		name:'voteScreen',
		component: voteScreen,
		meta: ['新建活动-报名'],
	},{
		path: '/editVoteScreen',   
		name:'editVoteScreen',
		component: editVoteScreen,
		meta: ['新建活动-活动编辑'],
	}, {
		path: '/setTemplate_code',   //口令活动设置
		name:'setTemplate_code',
		component: setTemplate_code,
		meta: ['新建活动-活动设置'],
	},  {
		path: '/eidtTplCode',   //口令活动编辑
		name:'eidtTplCode',
		component: eidtTplCode,
		meta: ['新建活动-活动编辑'],
	}, {
		path: '/editCommonTpl',
		name:'editCommonTpl',
		component: editCommonTpl,
		meta: ['活动管理-活动编辑'],
	},{
		path: '/web/activity/index',
		name:'activityList',
		component: activityList,
		meta: ['活动管理-活动列表'],
	}, {
		path: '/web/activity/statistics',
		name:'actStatistics',
		component: actStatistics,
		meta: ['活动管理-活动统计'],
	},  {
		path: '/statistics',
		name:'statistics',
		component: statistics,
		meta: ['活动统计-活动报表'],
	}, {
		path: '/web/prize/create',
		name:'newPrize',
		component: newPrize,
		meta: ['奖品管理-新建奖品'],
	},{
		path: '/newPlatformPrize',
		name:'newPlatformPrize',
		component: newPlatformPrize,
		meta: ['奖品管理-新建平台奖品'],
	},{
		path: '/web/prize/resources',
		name:'buyPrize',
		component: buyPrize,
		meta: ['奖品管理-购买奖品'],
	},{
        path: '/voteRecordCenter',
        name:'voteRecordCenter',
        component: voteRecordCenter,
        meta: ['活动列表-投票记录'],
    },{
        path: '/voteData',
        name:'voteData',
        component: voteData,
        meta: ['活动列表-投票数据'],
    },{
		path: '/recharge',
		name:'recharge',
		component: recharge,
		meta: ['账户管理-充值'],
	},{
		path: '/web/prize/edit',
		name:'editPrize',
		component: editPrize,
		meta: ['奖品管理-编辑奖品'],
	}, {
		path: '/web/prize/index',
		name:'prizeList',
		component: prizeList,
		meta: ['奖品管理-奖品列表'],
	},{
        path: '/web/prize/center',
        name:'prizeCenter',
        component: prizeCenter,
        meta: ['奖品管理-兑奖中心'],
    },{
		path: '/web/application/use_set',
		component: setMessage,
		meta: ['设置-微信设置'],
		children:[
			{
				path: '/web/application/wxSet',
				name:'wxSet',
				component: wxSet,
				meta: ['设置-微信设置'],
			},
			{
				path: '/web/application/config',
				name:'configSet',
				component: configSet,
				meta: ['设置-推送设置'],
			},
			{
				path: '/web/application/app_config',
				name:'apiConfigSet',
				component: apiConfigSet,
				meta: ['设置-对接设置'],
			},
			{
				path: '/web/application/set',
				name:'application',
				component: application,
				meta: ['设置-应用设置'],
			},
		],
	},{
		path: '/banners/position',
		name:'position',
		component: position,
		meta: ['投放活动-位置埋点'],
	},{
		path: '/banners/put-activity-list',
		name:'putActivityList',
		component: putActivityList,
		meta: ['投放活动-投放列表'],
	},{
		path: '/editPutList',
		name:'editPutList',
		component: editPutList,
		meta: ['投放活动-编辑投放'],
	},{
		path: '/banners/create',
		name:'putCreate',
		component: putCreate,
		meta: ['投放活动-新建投放'],
	},{
		path: '/triggers/event-admin',
		name:'eventAdmin',
		component: eventAdmin,
		meta: ['触发活动-触发行为管理'],
	},{
		path: '/triggers/list',
		name:'triggers',
		component: triggers,
		meta: ['触发活动-触发列表'],
	},{
		path: '/triggers/create',
		name:'triggersCreate',
		component: triggersCreate,
		meta: ['触发活动-新建触发'],
	},{
		path: '/triggers/edit',
		name:'editTriggers',
		component: editTriggers,
		meta: ['触发活动-编辑触发'],
	},{
		path: '/push/new',
		name:'pushNew',
		component: pushNew,
		meta: ['推送活动-新建推送'],
	},{
		path: '/push/list',
		name:'pushList',
		component: pushList,
		meta: ['推送活动-新建推送'],
	},
	{ path: '*', redirect: '/web/activity/dashboard' }
]

export default new Router({
	mode: 'hash',
	routes,
	strict: process.env.NODE_ENV !== 'production',
})
